package api

import (
	"360-cinema/api-getaway/basic/config"
	"360-cinema/api-getaway/basic/handler/request"
	__ "360-cinema/api-getaway/basic/videoProto"
	"github.com/gin-gonic/gin"
	"net/http"
)

func VideoShow(c *gin.Context) {
	var video request.VideoShow
	err := c.ShouldBind(&video)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 0,
			"msg":  "参数错误",
		})
		return
	}
	r, err := config.VideoClient.VideoShow(c, &__.VideoShowReq{VideoId: video.VideoId})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 0,
			"msg":  "查询失败",
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"Title":       r.Title,
		"Description": r.Description,
		"Actor":       r.Actor,
		"Play":        r.Play,
		"Director":    r.Director,
	})
}
